package node_dir

import (
	"fmt"
	"sanguo/cs"
	"strconv"
	"strings"
)

func Start(serverAddr string) error {
	t := strings.Split(serverAddr, ":")
	port, _ := strconv.Atoi(t[1])
	return cs.StartTcpServer("tcp", fmt.Sprintf("0.0.0.0:%d", port), &gDispatcher)
}

func init() {
	gDispatcher.handlers = map[string]handler{}
}
